package nbcp.flux

import nbcp.sys.MvcActionAware
import nbcp.base.comm.const
import nbcp.base.component.WebJsonMapper
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.BeanPostProcessor
import org.springframework.boot.autoconfigure.http.HttpMessageConverters
import org.springframework.boot.autoconfigure.web.servlet.MultipartProperties
import org.springframework.context.annotation.Import
import org.springframework.core.convert.support.GenericConversionService
import org.springframework.util.unit.DataSize
import org.springframework.util.unit.DataUnit

//@Component
@Import(
    MvcActionAware::class
)
class MyFluxInitConfig : BeanPostProcessor {
    companion object {
        private var inited = false;
        private val logger = LoggerFactory.getLogger(this::class.java.declaringClass)
    }

    override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any? {
        if (inited == false) {
            inited = true;

            init_app();
        }
        return super.postProcessBeforeInitialization(bean, beanName)
    }

    override fun postProcessAfterInitialization(bean: Any, beanName: String): Any? {
        return super.postProcessAfterInitialization(bean, beanName);
    }

    /**
     * 在所有Bean初始化之前执行
     */
    private fun init_app() {

    }

    /**
     * 系统预热之后，最后执行事件。
     */
//    @EventListener
//    fun app_started(event: ApplicationStartedEvent) {
//    }

}